import request from '@/utils/request'

const api = {
  getInventoryPageUrl: '/base_inventory/get_inventory_page',
  getInventoryInfoUrl: '/base_inventory/get_inventory_info',
  addInventoryInfoUrl: '/base_inventory/add_inventory_info',
  updateInventoryInfoUrl: '/base_inventory/update_inventory_info',
  syncInventoryUrl: '/base_inventory/sync_inv',
  daohuoSyncInvUrl: '/base_inventory/daohuo_sync_inv',
}

export async function daohuoSyncInvApi(data: Map<string, any>) {
  const res = await request({
    url: api.daohuoSyncInvUrl,
    method: 'post',
    data,
  })
  return res
}

export async function syncInventoryApi(params: Map<string, any>) {
  const res = await request({
    url: api.syncInventoryUrl,
    method: 'get',
    params: params,
    timeout: 20000,
  })
  return res
}

export async function getInventoryInfoApi(params: Map<string, any>) {
  const res = await request({
    url: api.getInventoryInfoUrl,
    method: 'get',
    params: params,
  })
  return res
}

export async function getInventoryPageApi(params: Map<string, any>) {
  const res = await request({
    url: api.getInventoryPageUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function addInventoryInfoApi(params: Map<string, any>) {
  const res = await request({
    url: api.addInventoryInfoUrl,
    method: 'post',
    data: params,
  })
  return res
}

export async function updateInventoryInfoApi(params: Map<string, any>) {
  const res = await request({
    url: api.updateInventoryInfoUrl,
    method: 'post',
    data: params,
  })
  return res
}
